package models

import "gorm.io/gorm"

type Dj struct {
	gorm.Model
	Title     string `gorm:"type:varchar(20);not null;comment:'标题'"`
	AreaId    int    `gorm:"type:int;not null;comment:'地区id'"`
	UserId    int    `gorm:"type:int;not null;comment:'用户'"`
	YearId    int    `gorm:"type:int;not null;comment:'年份id'"`
	TypeId    int    `gorm:"type:int;not null;comment:'类型id'"`
	Info      string `gorm:"type:varchar(20);not null;comment:'视频简介'"`
	ConUrl    string `gorm:"type:varchar(20);not null;comment:'封面地址'"`
	VideoUrl  string `gorm:"type:varchar(20);not null;comment:'视频的地址'"`
	VLike     int    `gorm:"type:int;not null;comment:'视频点赞数'"`
	Videonum  int    `gorm:"type:int;not null;comment:'视频观看次数'"`
	Status    int    `gorm:"type:varchar(20);not null;comment:'视频状态 1 封禁 2 没封禁'"`
	ConStatus int    `gorm:"type:varchar(20);not null;comment:'视频发布状态 1 发不失败 2 发布成功'"`
	WatchTime int    `gorm:"type:int;not null;comment:'观看时长'"`
	VideoId   int    `gorm:"type:int;not null;comment:'视频id'"`
}

func (d *Dj) GetDj(db *gorm.DB, id int) error {
	err := db.Model(&Dj{}).Where("id =?", id).Limit(1).Find(&d).Error
	return err
}

func (d *Dj) CreateDj(db *gorm.DB) error {
	err := db.Create(&d).Error
	return err
}
